package com.sky.wsp.stream.service;

import com.sky.wsp.stream.config.UserXuanYanInputSink;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.messaging.Message;
import org.springframework.stereotype.Controller;


@EnableBinding(UserXuanYanInputSink.class)
@Controller
public class XuanYanReceiveMessageListener {
 
    @Value("${server.port}")
    private String serverPort;
 
    @StreamListener(UserXuanYanInputSink.INPUT) // 监听
    public void input(Message<String> message){
        System.out.println("XuanYan消费者1号------>收到的消息：" + message.getPayload() + "\t port：" + serverPort);
    }
 
}